//------------------------------------------------------------------------------
// X2D Game Engine
// Copyright (C) 2006-2007 Janusz Kowalski
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
//------------------------------------------------------------------------------

#include <cstdio>

#ifndef PMSG_HEADER
#define PMSG_HEADER

// Messages sent to stdout, stderr, logfile, or other place in the way that doesn't interrupt
// user's actions.

// Waning message.
void pmsgWarningF(const char *format, ...);

// Error message.
void pmsgErrorF(const char *format, ...);

// Info message.
void pmsgInfoF(const char *format, ...);

// Debug message.
void pmsgDebugF(const char *format, ...);

void pmsgSetLogStream(FILE *stream);

// Assertion.
#define REQUIRE(cond) if(!(cond)) {\
  pmsgErrorF("%s:%d:%s : Requirement %s failed.\n",__FILE__,(int)__LINE__,__FUNCTION__, #cond);\
  throw "Req. " #cond " failed.";}

#define ASSURE(cond) if(!(cond)) {\
  pmsgErrorF("%s:%d:%s : Requirement %s failed.\n",__FILE__,(int)__LINE__,__FUNCTION__, #cond);\
  throw "Req. " #cond " failed.";}


#endif
